package com.game.ThauanLopes;

import java.util.HashSet;
import java.util.Random;

import com.game.ThauanLopes.GameObject;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;

public class Enemie extends GameObject {

	public int xVelocity = 4;
	
	public int radial = 20;
	public int x;
	public int y;

	public Paint paint;
	public int gameCanvasWidth;
	public int gameCanvasHeight;
	
	public Enemie(int canvasWidth, int canvasHeight, HashSet<GameObject> hs)
	{
		this.paint = new Paint();
		this.paint.setColor(Color.RED);
		
		this.gameCanvasWidth = canvasWidth;
		this.gameCanvasHeight = canvasHeight;
		
		Random random = new Random();
		int temp = random.nextInt(2);
		if(temp == 1)
		{
			this.x = 0; 
		}
		else 
		{ 
			this.x = this.gameCanvasWidth; 
		} 
		
		this.y = Game.floor;
		
		hs.add(this);
		
	}

	public void Update()
	{
		x += xVelocity;
		if(x + this.radial > gameCanvasWidth)
		{	
			x = gameCanvasWidth - radial;
		}
		if(x - this.radial < 0)
		{
			x = this.radial;
		}
		
	}
	@Override
	public void Draw(Canvas canvas)
	{
		canvas.drawCircle(x, y, radial, paint);
		
	}
	
	public void SetPotsition(float x, float y)
	{
		this.x = (int) x;
		this.y = (int) y;
	}

	@Override
	public boolean collision(Rect fingersPos) {
		// TODO Auto-generated method stub
		return false;
	}


}
